//
//  FirstGuideController.m
//  DYKT
//
//  Created by 陈雷 on 2017/8/9.
//  Copyright © 2017年 windo. All rights reserved.
//

#import "FirstGuideController.h"
#import "AppDelegate.h"
#import "AppDelegate+RootController.h"

@interface FirstGuideController ()

@property (nonatomic,strong) UIScrollView *bigScrollV;
@end

@implementation FirstGuideController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.bigScrollV];
    
    for (int i = 0; i < 4; i ++) {
        UIImageView *imv = [[UIImageView alloc]initWithFrame:CGRectMake(i * KSCreenWidth, 0, KSCreenWidth, KSCreenHeight)];
        NSArray *imgArr = @[@"JF使用步骤1",@"JF使用步骤2",@"JF使用步骤3",@"JF使用步骤4"];
        imv.image = [UIImage imageNamed:imgArr[i]];
        [self.bigScrollV addSubview:imv];
        
        if (i == 3) {
            UIButton *swapBtn2 = [UIButton buttonWithType:UIButtonTypeCustom];
            swapBtn2.frame = CGRectMake(0, KSCreenHeight - 100, KSCreenWidth, 80);
            swapBtn2.layer.cornerRadius = 10;
            swapBtn2.layer.masksToBounds = YES;
            [swapBtn2 setTitle:@"立即进入" forState:UIControlStateNormal];
            swapBtn2.titleLabel.font = [UIFont systemFontOfSize:14];
//            swapBtn2.backgroundColor = greenColor;
            swapBtn2.alpha = .6;
            imv.userInteractionEnabled = YES;
            
            [swapBtn2 addTarget:self action:@selector(swapAction) forControlEvents:UIControlEventTouchUpInside];
            [imv addSubview:swapBtn2];
        }
    }
}

- (UIScrollView *)bigScrollV{
    if (!_bigScrollV) {
        _bigScrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KSCreenWidth, KSCreenHeight)];
        _bigScrollV.contentSize = CGSizeMake(KSCreenWidth * 4, KSCreenHeight);
        _bigScrollV.backgroundColor = [UIColor whiteColor];
        [_bigScrollV setAlwaysBounceHorizontal:NO];
        _bigScrollV.showsVerticalScrollIndicator = NO;
        _bigScrollV.showsHorizontalScrollIndicator = NO;
        _bigScrollV.pagingEnabled = YES;
    }
    return _bigScrollV;
}

#pragma mark- 跳到登录界面
- (void)swapAction{
    
    [UserDefaults setObject:@"haveUse" forKey:@"firstLogin"];
    [UserDefaults synchronize];
    //显示登录界面
    [appDelegate setTabbarController];
    
}

@end
